using System;
using Glade;
using Gtk;

namespace DreamPark
{
	public class Screen_Accueil
	{
		private ControleurEntree ctrlEntree;
		private int acces;
		
		[Glade.Widget]
		Label LabelPlaceDispos;
		
		[Glade.Widget]
		Window FenetreAccueilParking;
		
		[Glade.Widget]
		ComboBox ComboboxTypeVehicule;
		
		public Screen_Accueil (int acces, ControleurEntree ctrlEntree)
		{
            Glade.XML gxml = new Glade.XML (null, "DreamPark.FenetreAccueil.glade", "FenetreAccueilParking", null);
			
            gxml.Autoconnect (this);
			
			this.acces = acces;
			this.ctrlEntree = ctrlEntree;
			LabelPlaceDispos.Text = ctrlEntree.Parking.PlacesLibres.ToString();
			
			// PRINTER LES TRACES TAVU
		}
		
		public void BoutonDeposerVehicule_clicked_cb(System.Object obj, EventArgs e){
			
			if (ctrlEntree.Parking.PlacesLibres == 0) {
				Screen_ParkingPlein fenetreParkingPlein = new Screen_ParkingPlein (ctrlEntree, acces);
				
				FenetreAccueilParking.Destroy();
			} else {
			
				int typeSelected = ComboboxTypeVehicule.Active;
				TypeVehicule type = TypeVehicule.Voiture;
				
				switch (typeSelected) {
					case 0:
						type = TypeVehicule.Voiture;
						break;
					case 1:
						type = TypeVehicule.Fourgon;
						break;
					case 2:
						type = TypeVehicule.Moto;
						break;
					case 3:
						type = TypeVehicule.Break;
						break;
					case 4:
						type = TypeVehicule.Monospace;
						break;
				}
				
				Screen_DeposerVehicule fenetreDeposerVehicule = new Screen_DeposerVehicule(type, acces, ctrlEntree);
				FenetreAccueilParking.Destroy();
			}
		}
		
		public void BoutonRecupererVehicule_clicked_cb(System.Object obj, EventArgs e){
			Screen_RetraitVehicule fenetreRecupererVehicule = new Screen_RetraitVehicule(ctrlEntree, acces);
			FenetreAccueilParking.Destroy();
		}
	}
}

